import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '物料名称',
    align: 'left',
    dataIndex: 'wulName'
  },
  {
    title: '物料编码',
    align: 'center',
    dataIndex: 'wulCode'
  },
  {
    title: '封面图',
    align: 'center',
    dataIndex: 'picc',
    customRender: render.renderImage,
  },
  {
    title: '年度',
    align: 'center',
    dataIndex: 'year1',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      if(text) {
        return getWeekMonthQuarterYear(text)['year'];
      } else {
        return text;
      }
    },
  },
  {
    title: '星期',
    align: 'center',
    dataIndex: 'xingqi',
    customRender:({text}) =>{
      text = !text ? "" : (text.length > 10 ? text.substr(0,10) : text);
      if(text) {
        return getWeekMonthQuarterYear(text)['week'];
      } else {
        return text;
      }
    },
  },
  {
    title: '富文本',
    align: 'center',
    dataIndex: 'fuwenb',
  },
  {
    title: '用户',
    align: 'center',
    dataIndex: 'yonhu_dictText'
  },
  {
    title: '关联请假单',
    align: 'center',
    dataIndex: 'guanl'
  },
];

// 高级查询数据
export const superQuerySchema = {
  wulName: {title: '物料名称',order: 0,view: 'text', type: 'string',},
  wulCode: {title: '物料编码',order: 1,view: 'text', type: 'string',},
  picc: {title: '封面图',order: 2,view: 'image', type: 'string',},
  year1: {title: '年度',order: 4,view: 'date', type: 'string',},
  xingqi: {title: '星期',order: 5,view: 'date', type: 'string',},
  fuwenb: {title: '富文本',order: 6,view: 'umeditor', type: 'string',},
  yonhu: {title: '用户',order: 7,view: 'sel_user', type: 'string',},
  guanl: {title: '关联请假单',order: 8,view: 'link_table', type: 'string',},
};
